import React, { Component } from 'react'
import PubSub from 'pubsub-js';

export default class Form extends Component {
    render() {
        return (
            <div>
                <input ref={el => this.input = el} type="text" /> <button onClick={this.send}>点击发送</button>
            </div>
        )
    }

    send = () => {
        //获取表单输入的值
        let v = this.input.value;
        //发布
        PubSub.publish('keyword', v);
    }
}
